aUSD

Row

Components of Total Value Locked

Row

aUSD Issuance

Block Date aUSD_Karura aUSD_Acala aUSD_Total
1216792 2021-12-30 10,290,227 5,817,751 16,107,978
1223729 2021-12-31 10,091,012 5,548,380 15,639,391
1230690 2022-01-01 10,182,105 5,566,857 15,748,962
1237666 2022-01-02 10,179,270 5,310,473 15,489,743
1244636 2022-01-03 10,093,426 5,279,072 15,372,498
1251539 2022-01-04 9,910,712 5,277,526 15,188,238
1258602 2022-01-05 9,746,031 5,246,518 14,992,549
1265574 2022-01-06 9,752,259 5,275,808 15,028,068
1272463 2022-01-07 9,661,268 4,348,873 14,010,141
1279512 2022-01-08 9,564,227 4,370,317 13,934,543
1286513 2022-01-09 9,557,633 4,374,946 13,932,579
1293438 2022-01-10 9,580,698 4,390,869 13,971,567
1300364 2022-01-11 8,927,325 4,373,673 13,300,997
1307287 2022-01-12 8,992,258 4,390,227 13,382,485
1314250 2022-01-13 9,000,353 4,378,522 13,378,876
1321145 2022-01-14 9,006,750 4,377,592 13,384,342
1327988 2022-01-15 9,010,572 4,366,637 13,377,210
1334836 2022-01-16 8,978,816 4,332,634 13,311,450
1341616 2022-01-17 8,915,504 4,335,009 13,250,513
1348556 2022-01-18 8,954,744 4,335,009 13,289,752
1355482 2022-01-19 8,949,750 4,335,009 13,284,759
1362368 2022-01-20 8,957,900 4,335,009 13,292,909
1369220 2022-01-21 7,868,068 4,335,009 12,203,077
1376066 2022-01-22 6,270,610 4,335,009 10,605,619
1382988 2022-01-23 6,350,365 4,335,009 10,685,374
1389889 2022-01-24 6,048,434 4,335,009 10,383,443
1396806 2022-01-25 5,788,839 4,335,009 10,123,847
1403696 2022-01-26 5,669,633 4,335,009 10,004,642
1410563 2022-01-27 5,508,799 4,335,009 9,843,808
1417498 2022-01-28 5,517,955 4,335,009 9,852,964
1424433 2022-01-29 5,524,636 4,335,009 9,859,645
1431336 2022-01-30 5,509,986 4,335,009 9,844,994
1438201 2022-01-31 5,440,480 4,335,009 9,775,488
1445158 2022-02-01 5,493,135 4,335,009 9,828,144
1452085 2022-02-02 5,462,363 4,335,009 9,797,372
1459034 2022-02-03 5,405,381 4,335,009 9,740,390
1465910 2022-02-04 5,466,083 4,335,009 9,801,092
1472341 2022-02-05 5,421,444 4,335,009 9,756,453
1478495 2022-02-06 5,422,051 4,335,009 9,757,060
1484572 2022-02-07 5,432,589 4,335,009 9,767,598
1489375 2022-02-08 5,330,818 4,335,009 9,665,827
1493799 2022-02-09 5,367,400 4,335,009 9,702,409
1498135 2022-02-10 5,767,842 4,335,009 10,102,851
1502412 2022-02-11 5,650,252 4,335,009 9,985,261
1506675 2022-02-12 5,646,145 4,335,009 9,981,153
1510965 2022-02-13 5,856,542 4,335,009 10,191,551
1515339 2022-02-14 5,841,993 4,335,009 10,177,002
1519779 2022-02-15 5,860,838 4,335,009 10,195,847
1524208 2022-02-16 5,821,150 4,335,009 10,156,159
1528534 2022-02-17 5,721,577 4,335,009 10,056,585
1532831 2022-02-18 5,648,546 4,335,009 9,983,554
1537082 2022-02-19 5,553,868 4,335,009 9,888,877
1541290 2022-02-20 5,281,255 4,335,009 9,616,264
1545293 2022-02-21 5,215,281 4,335,009 9,550,290
1549212 2022-02-22 5,018,519 4,335,009 9,353,528
1553133 2022-02-23 4,970,303 4,335,009 9,305,311
1557141 2022-02-24 4,643,933 4,335,009 8,978,942
1561208 2022-02-25 4,675,561 4,335,009 9,010,570
1565186 2022-02-26 4,676,162 4,335,009 9,011,171
1569198 2022-02-27 4,627,923 4,335,009 8,962,932
1573192 2022-02-28 4,673,425 4,335,009 9,008,434
1577360 2022-03-01 4,728,346 4,335,009 9,063,354
1581658 2022-03-02 4,750,544 4,335,009 9,085,553
1586008 2022-03-03 4,682,114 4,335,009 9,017,123
1590339 2022-03-04 4,617,155 4,335,009 8,952,164
1594558 2022-03-05 4,588,524 4,335,009 8,923,533
1598920 2022-03-06 4,592,027 4,335,009 8,927,036
1603233 2022-03-07 4,572,082 4,335,009 8,907,091
1607573 2022-03-08 4,570,846 4,335,009 8,905,854
1611910 2022-03-09 4,671,687 4,335,009 9,006,696
1616357 2022-03-10 4,568,758 4,335,009 8,903,767
1620876 2022-03-11 4,579,459 4,335,009 8,914,468
1625432 2022-03-12 4,581,608 4,335,009 8,916,617
1629884 2022-03-13 4,537,367 4,335,009 8,872,376
1634405 2022-03-14 4,504,974 4,335,009 8,839,983
1638930 2022-03-15 4,517,668 4,335,009 8,852,677
1643457 2022-03-16 4,550,885 4,335,009 8,885,894
1647983 2022-03-17 4,590,944 4,335,009 8,925,953
1652652 2022-03-18 4,675,263 4,335,009 9,010,272
1657396 2022-03-19 4,724,276 4,335,009 9,059,285
1662219 2022-03-20 4,750,389 4,335,009 9,085,398
1666997 2022-03-21 4,805,186 4,335,009 9,140,195
1671509 2022-03-22 4,827,630 4,335,009 9,162,639
1675850 2022-03-23 4,865,881 4,335,009 9,200,889
1680082 2022-03-24 4,857,238 4,335,009 9,192,247
1684322 2022-03-25 4,869,007 4,335,009 9,204,016
1688574 2022-03-26 4,849,235 4,335,009 9,184,244
1692713 2022-03-27 4,895,435 4,335,009 9,230,444
1696873 2022-03-28 4,930,751 4,335,009 9,265,760
1700908 2022-03-29 5,067,601 4,335,009 9,402,610
1704922 2022-03-30 5,130,914 4,335,009 9,465,923
1708906 2022-03-31 5,239,132 4,335,009 9,574,141
1712970 2022-04-01 5,202,627 4,335,209 9,537,836
1717078 2022-04-02 5,278,899 4,335,209 9,614,108
1721276 2022-04-03 5,282,403 4,335,209 9,617,612
1725277 2022-04-04 5,155,766 4,335,209 9,490,975
1729249 2022-04-05 5,172,532 4,335,209 9,507,741
1733105 2022-04-06 5,083,636 4,335,209 9,418,845
1736920 2022-04-07 5,356,936 4,335,209 9,692,145
1740728 2022-04-08 5,333,274 4,335,209 9,668,483
1744511 2022-04-09 5,305,469 4,335,209 9,640,678
1748342 2022-04-10 5,351,529 4,335,209 9,686,738
1752148 2022-04-11 5,148,440 4,335,209 9,483,649
1756009 2022-04-12 5,168,805 4,335,209 9,504,014
1759810 2022-04-13 5,166,177 4,335,209 9,501,386
1763619 2022-04-14 5,181,003 4,335,209 9,516,212
1767375 2022-04-15 5,225,609 4,335,209 9,560,817
1771087 2022-04-16 5,231,498 4,335,209 9,566,707
1774902 2022-04-17 5,221,374 4,335,209 9,556,583
1778708 2022-04-18 5,204,413 4,335,209 9,539,622
1782472 2022-04-19 5,197,599 4,335,209 9,532,808
1786343 2022-04-20 5,234,624 4,335,209 9,569,833
1790294 2022-04-21 5,315,784 4,335,209 9,650,993
1794197 2022-04-22 5,277,628 4,335,209 9,612,837
1798162 2022-04-23 5,548,256 4,335,209 9,883,465
1802115 2022-04-24 5,465,898 4,335,209 9,801,107
1806087 2022-04-25 5,464,495 4,335,209 9,799,704
1810046 2022-04-26 5,443,354 4,335,209 9,778,563
1814021 2022-04-27 5,414,557 4,335,209 9,749,766
1817974 2022-04-28 5,417,024 4,335,209 9,752,233
1821980 2022-04-29 5,401,302 4,335,209 9,736,511
1826039 2022-04-30 5,325,695 4,335,209 9,660,904
1830125 2022-05-01 5,308,806 4,335,209 9,644,015
1834044 2022-05-02 5,290,063 4,335,209 9,625,272
1837991 2022-05-03 5,289,398 4,335,209 9,624,607
1841986 2022-05-04 5,297,538 4,335,209 9,632,747
1846132 2022-05-05 5,283,745 4,335,209 9,618,954
1850190 2022-05-06 5,288,666 4,335,209 9,623,876
1854421 2022-05-07 5,234,538 4,335,209 9,569,747
1858658 2022-05-08 5,049,196 4,335,209 9,384,405
1862992 2022-05-09 4,856,056 4,335,209 9,191,266
1867957 2022-05-10 4,445,392 4,335,209 8,780,601
1873972 2022-05-11 3,975,273 4,335,209 8,310,482
1880188 2022-05-12 3,790,518 4,335,209 8,125,727
1886554 2022-05-13 3,828,842 4,335,209 8,164,051
1892961 2022-05-14 3,812,935 4,335,209 8,148,145
1899371 2022-05-15 3,856,292 4,335,209 8,191,501
1905778 2022-05-16 3,925,850 4,335,209 8,261,059
1912230 2022-05-17 3,977,072 4,335,209 8,312,281
1918591 2022-05-18 3,942,409 4,335,209 8,277,618
1924950 2022-05-19 3,999,092 4,335,209 8,334,301
1931289 2022-05-20 3,997,746 4,335,209 8,332,955
1937640 2022-05-21 4,028,271 4,335,209 8,363,480
1944002 2022-05-22 4,053,215 4,335,209 8,388,424
1950438 2022-05-23 4,092,102 4,335,209 8,427,311
1956833 2022-05-24 4,104,772 4,335,209 8,439,982
1963028 2022-05-25 4,100,411 4,335,209 8,435,620
1969604 2022-05-26 4,072,206 4,335,209 8,407,415
1975998 2022-05-27 4,055,514 4,335,209 8,390,723
1982535 2022-05-28 4,063,472 4,335,209 8,398,682
1988972 2022-05-29 4,065,723 4,335,209 8,400,932
1995443 2022-05-30 4,075,179 4,335,209 8,410,388
2001782 2022-05-31 4,196,753 4,335,209 8,531,962
2008273 2022-06-01 4,184,512 4,335,209 8,519,721
2014698 2022-06-02 4,192,668 4,335,209 8,527,877
2021059 2022-06-03 4,151,279 4,335,209 8,486,488
2027513 2022-06-04 4,154,170 4,335,209 8,489,380
2034053 2022-06-05 4,166,220 4,335,209 8,501,429
2040490 2022-06-06 4,179,423 4,335,209 8,514,632
2046816 2022-06-07 4,177,516 4,335,209 8,512,725
2053305 2022-06-08 4,178,977 4,335,209 8,514,187
2059744 2022-06-09 4,177,130 4,335,209 8,512,339
2066092 2022-06-10 4,149,014 4,335,209 8,484,223
2072325 2022-06-11 4,102,379 4,335,209 8,437,588
2078699 2022-06-12 4,004,056 4,335,209 8,339,265
2084974 2022-06-13 3,729,152 4,335,209 8,064,361
2091245 2022-06-14 3,735,276 4,335,209 8,070,486
2097549 2022-06-15 3,788,931 4,335,209 8,124,140
2103874 2022-06-16 3,784,345 4,335,209 8,119,554
2110292 2022-06-17 3,780,450 4,335,209 8,115,659
2116724 2022-06-18 3,744,797 4,335,209 8,080,007
2123104 2022-06-19 3,770,456 4,335,209 8,105,665
2129497 2022-06-20 3,773,566 4,335,209 8,108,776
2135922 2022-06-21 3,819,698 4,335,209 8,154,907
2142278 2022-06-22 3,827,112 4,335,209 8,162,321
2148575 2022-06-23 3,829,884 4,335,209 8,165,093
2155139 2022-06-24 3,832,776 4,335,209 8,167,985
2161562 2022-06-25 3,852,269 4,335,209 8,187,479
2168013 2022-06-26 3,876,004 4,335,209 8,211,213
2173904 2022-06-27 3,839,320 4,335,209 8,174,529
2179759 2022-06-28 3,806,037 4,335,209 8,141,246
2185605 2022-06-29 3,806,447 4,335,209 8,141,657
2190169 2022-06-30 3,774,876 4,335,209 8,110,085

Row

Sources and Notes

Please click on the Source Code link at the top of the document to see the full source code. Here is a summary:

aUSD

  • aUDS (or kUSD) obtained from the py-substrate-interface using function substrate.query(module=‘Tokens’,storage_function=‘TotalIssuance’, params = [{‘Token’: ‘AUSD’}], block_hash = hash)
---
title: "Acala / Karura aUSD Dashboard"
output:
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: scroll
    social: menu
    source_code: embed

---

```{css custom1, echo=FALSE}
.dataTables_scrollBody {
    max-height: 100% !important;
}
```

```{r global, include=FALSE}
library(knitr)
knitr::opts_chunk$set(
  message = FALSE,
  warning = FALSE,
  comment = "#>"
)

library(ggplot2)
# library(dygraphs)
library(kableExtra)
library(formattable)
library(lubridate)
library(flexdashboard)
library(DT)
library(subscanr)
library(formattable)
library(ghql)
x <- GraphqlClient$new()

# Helper function to concat
`%+%` <- function(a, b) paste0(a, b)

window <- today() - as.Date("2021-12-31") + 1

# Liquidity Pool TVL ($3.72M) = totalDefiTvl = totalDexTvl + totalDexLockedTvl + homaLocked + stableCoinTvl
dex <- getDailyPools_acala_dex("karura", window) %>%
  setorder(Date, pair)

dailyTVL <- dex[, max(updateAtBlock.id), by = Date] %>%
  setnames("V1", "Block")

library(reticulate)
# use_python("/opt/homebrew/bin/python3.9")
```

```{python, include=FALSE}
from substrateinterface import SubstrateInterface

import pandas as pd

def getTotalIssuance(network):
    if network=="Karura":
        url = 'wss://karura.polkawallet.io'
        token = 'KUSD'
    else:
        url = 'wss://acala-rpc-0.aca-api.network'
        token = 'AUSD'
        
    substrate = SubstrateInterface(url)
    data = []
    for block_id in r.blocks:
        hash = substrate.get_block_hash(int(block_id))
        ausd = substrate.query(module='Tokens',storage_function='TotalIssuance', params = [{'Token': token}], block_hash = hash)
        outi = {"Block": block_id, 'aUSD': ausd.value / 10**12}
        data.append(outi)
    
    out = pd.DataFrame(data)
    return out

```



```{r tvl, cache = TRUE, include=FALSE}

  blocks <- dailyTVL$Block
  kusd = py$getTotalIssuance("Karura")
  ausd = py$getTotalIssuance("Acala")
  dailyTVL <- merge(dailyTVL, kusd, by = "Block") %>%
    setnames("aUSD", "aUSD_Karura")
  dailyTVL <- merge(dailyTVL, ausd, by = "Block") %>%
    setnames("aUSD", "aUSD_Acala")
  dailyTVL[, aUSD_Total := aUSD_Karura + aUSD_Acala]
  
```

# aUSD {.tabset}

Row
----

### Components of Total Value Locked

```{r k_plot1}

dat <- melt(data = dailyTVL[, .(Date, aUSD_Karura, aUSD_Acala)], 
      id.vars = "Date",
      value.name = "aUSD")
dat[, aUSD := aUSD / 1e6]
 
# Stacked
ggplot(dat, aes(fill=variable, y=aUSD, x=Date)) + 
    geom_bar(position="stack", stat="identity") +
    ggtitle(label="Issuance of aUSD") + 
    ylab("aUSD (in millions USD)")

```

Row
----

### aUSD Issuance

```{r ausd}

knitr::kable(dailyTVL, escape = FALSE, format.args = list(big.mark = ",")) %>%
  kable_styling()

```

Row
----

### Sources and Notes

Please click on the *Source Code* link at the top of the document to see the full source code.  Here is a summary:

#### aUSD
- aUDS (or kUSD) obtained from the [py-substrate-interface](https://github.com/polkascan/py-substrate-interface) using function *substrate.query(module='Tokens',storage_function='TotalIssuance', params = [{'Token': 'AUSD'}], block_hash = hash)*